<?php
include 'includes.php';
include 'functions.php';
include 'admin-functions.php';
include 'config.php';
session_start();

if ( isset($_POST['logout'])){
	$_SESSION = array();
	session_destroy();
}
check_admin();
?>

<html xmlns="http://www.w3.org/1999/xhtml"><!-- Mirrored from themes.voodoo-pixel.com/skate/index-2.html by HTTrack Website Copier/3.x [XR&CO'2010], Fri, 16 Dec 2011 13:45:35 GMT --><head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="">
<meta name="description" content="">

<!--Title of your website-->
<title>Pannello Amministratore</title>

<!--CSS Styles-->
<link rel="stylesheet" type="text/css" href="css/style-1.css">
<link rel="stylesheet" type="text/css" href="css/typography.css">
<link rel="stylesheet" type="text/css" href="css/slider.css">
<link rel="stylesheet" type="text/css" href="css/prettyPhoto.css">
<link rel="stylesheet" href="css/jquery.fancybox.css?v=2.0.4" type="text/css" media="screen" />


<!--Java Script-->
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/accordion.js"></script>
<script type="text/javascript" src="js/functions.js"></script> 
<script type="text/javascript" src="js/supersubs.js"></script> 
<script type="text/javascript" src="js/superfish.js"></script> 
<script type="text/javascript" src="js/nivo-slider.js"></script>
<script type="text/javascript" src="js/jquery.prettyPhoto.js"></script>
<script type="text/javascript" src="js/jquery.fancybox.pack.js?v=2.0.4"></script>

<!-- Script e css personalizzati -->
<script type="text/javascript" src="js/jquery.numeric.js"></script>
<script type="text/javascript" src="js/jquery.validate.js"></script>
<script type="text/javascript" src="js/jquery.validation.messages_it.js"></script>


<style type="text/css">.jlhlebbhengjlhmcjebbkambaekglhkf {top: 0px; left: 0px;min-width: 30px;max-width: 300px;font-size: 13px;font-family: arial, helvetica, sans-serif;opacity: .93;padding:0px;position:absolute;display:block;z-index: 999997;font-style: normal;font-variant: normal;font-weight: normal;}#jlhlebbhengjlhmcjebbkambaekglhkf_up{text-align: center;padding:0px;margin: 0px;}#jlhlebbhengjlhmcjebbkambaekglhkf_cont{background-color: #729FCF;font-family: arial, helvetica, sans-serif-webkit-box-shadow: #729FCF 0px 0px 2px;color: #FFFFFF;padding:7px;-webkit-border-radius: 5px;}#jlhlebbhengjlhmcjebbkambaekglhkf_down{text-align: center;padding:0px;margin: 0px;}</style></head>


<!--Body-->
<body> 

<!--Wrapper-->
<div id="wrapper">

<!--Header-->
	<div id="header">
  
<!--Logo-->
	
    
<!--Top Banner
	<div class="top-banner">
	<img src="images/demo/banners/top_banner.jpg" width="468" height="60" alt="Top-banner" />
	</div>
	-->
	
	</div>
	
	
	<ul class="sf-menu sf-js-enabled">
		<li><a href="admin.php" <?=is_current("admin.php");?>>Pannello Amministratore</a></li>
		<li><a href="admin-upload-list.php" <?=is_current("admin-upload-list.php");?>>Carica Lista Libri</a></li>
		<li><a href="admin-profile.php" <?=is_current("admin-profile.php");?>>Profilo</a></li>
		
		<li style="float:right;"><a href="#"  onclick="document.logout_form.submit()" >Logout</a></li>
		<form id="logout_form" name="logout_form" action="" method="POST">
			<input type="hidden" id="logout" name="logout"/>
		</form>
		
	</ul>
	
	
	<div id="#main-content full_width" style="background: white;">
		<div id="book_list_container">
			<h1>Elenco Ordini da gestire</h1>
		
		
			<div id="order_list">
			<?php print_requests();?>
		
		
	

	
    
	</div>
</div>




<script type="text/javascript">

$(".operation").click(function(){
	
	
	var id = $(this).parents("tr").find(".request_id").val();
	var content = "<div> ";
	if ( $(this).attr("id") =="complete" ){
		request_type="complete";
		content+= "<h6>Sei sicuro di voler contrassegnare questo ordine come completato?</h6>";
		
	}
	else{
		request_type="delete";
		content+= "<h6>Sei sicuro di voler eliminare questo ordine?</h6>";
		
	}
	content+="<div style='margin:auto;display:table;'>";
	content+="<a onclick='complete_request("+id+",\""+request_type+"\")' href='javascript:return false;' class='button orange-button complete-request'>Ok</a>";
	content+="<a href='javascript:$.fancybox.close();' class='button orange-button delete-request'>Annulla</a>";
	content+="</div>";
	var link = $(this);
	var orig_background = $(this).parents("tr").css("background-color");

	$.fancybox({
			openEffect	: 'fade',
	    	closeEffect	: 'elastic',
			//modal: true,
			content : content,
			width		: '300px',
			height		: '100px',
			autoSize	: false,			beforeLoad: function(){ 	$(link).parents("tr").css("background-color","yellow"); },
			afterClose: function(){ 	$(link).parents("tr").css("background-color", orig_background ); },
			helpers	: {
				overlay	: {
					opacity : 0.1
					
				}
			}	    	
	});
});


function complete_request(request_id, request_type){

	
	$.ajax({
		  url: 'admin-ajax.php',
		  type: "POST",
		  data: {request_type: request_type, request_id: request_id},
		  dataType: "json",
		  success: function( data ) {
				  
		    if ( data['request_completed'] == true ){
		    	$.fancybox.close() ;
				$("#"+request_id).parents("tr").slideUp("slow");
				$("#"+request_id).parents("tr").next().slideUp("slow");
			}
			    
		  }
		});
	
}


$(".more").click(function(){
	var content ="<div style='width:600px'><h6>Ulteriori richieste di: "+ $(this).parents("tr").find(".name").html()+"</h6>";
	content+=$(this).parents("tr").find(".additional-fulltext").html()+"</div>";
	var link = $(this);
	var orig_background = $(this).parents("tr").css("background-color");
	
	$.fancybox({
		openEffect	: 'elastic',
    	closeEffect	: 'elastic',
    	beforeLoad: function(){ 	$(link).parents("tr").css("background-color","yellow"); },
		afterClose: function(){ 	$(link).parents("tr").css("background-color", orig_background ); },
    	scrolling : 'auto',
		content : content,
		helpers	: {
			overlay	: {
				opacity : 0.1,
				css : {
					'background-color' : '#000'
				}
			}
		}	    	
});
	
});



$(".view-books").click(function(){
	var orig_background = $(this).parents("tr").css("background-color");
	$(this).parents("tr").next().fadeToggle("slow");
	
});


</script>
<script type="text/javascript" src="https://www.google.com/jsapi?key=ABQIAAAAhsLC7op2IZocFRdmvLMBORT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRst5mULoL3XKzJMdUWZMkZ2AWLVw">
</script>
<script type="text/javascript">
  google.load("jqueryui", "1.7.2");
</script>
</body>
</html>